package com.sduept.nwld.dataserver.manager.etl;

import com.sduept.core.dao.SuperDAO;
import com.sduept.bigdata.weather.map.MapDataCache;
import com.sduept.nwld.dataserver.manager.protection.ProtectOverhaulManager;
import com.sduept.nwld.dataserver.model.daily.OverhaulMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OverhualMagService {
	@Autowired
	private SuperDAO dao;
	@Autowired
	private ProtectOverhaulManager manager;
	@Autowired
	private MapDataCache cimCache;
	
//	@Schedule(dayOfWeek="*",hour="*", minute="0",second="1",persistent=false) todo springboot
	@Scheduled(cron = "1 0 * * * ?")
	public void updateOverhaulMsg(){
		List<OverhaulMsg> findAll = dao.findByCondition(OverhaulMsg.class,"done !='已完工'");
		for(OverhaulMsg msg:findAll){
			OverhaulMsg overhaulMsg = manager.updateOverhaulMsgBySatus(msg);
			dao.update(overhaulMsg, OverhaulMsg.class);
		}
		
	}
}
